class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table "users", :force => true do |t|
      t.column :login,                     :string
      t.column :email,                     :string
      t.column :crypted_password,          :string, :limit => 40
      t.column :salt,                      :string, :limit => 40
      t.column :created_at,                :datetime
      t.column :updated_at,                :datetime
      t.column :remember_token,            :string
      t.column :remember_token_expires_at, :datetime
      t.column :activation_code, :string, :limit => 40
      t.column :activated_at, :datetime
      t.column :state, :string, :null => :no, :default => 'passive'
      t.column :deleted_at, :datetime
      t.column :role, :string
    end

    user = User.create(:login => "admin", :email => "admin@example.com", :password => "admin", :password_confirmation => "admin")
    user.role = "admin"
    user.activate!
    user.save!

    user = User.create(:login => "mentor", :email => "mentor@example.com", :password => "mentor", :password_confirmation => "mentor")
    user.role = "mentor"
    user.activate!
    user.save!

    user = User.create(:login => "mentee", :email => "mentee@example.com", :password => "mentee", :password_confirmation => "mentee")
    user.role = "mentee"
    user.activate!
    user.save!

  end

  def self.down
    drop_table "users"
  end
end
